#include "thread.h"

int rm(int netfd,sharInfo_t *sharInfo,MYSQL * mysql){
    train_t train;
    bzero(&train,sizeof(train_t));
    recv(netfd,&train.length,sizeof(int),MSG_NOSIGNAL);
    recv(netfd,train.buf,train.length,MSG_NOSIGNAL);
    remove_trailing_invisible_chars(train.buf);
    char filename[256];
    strcpy(filename,train.buf);
    char sql[1024];
    int parID=sharInfo->parentID;
    if(parID==-1){
        parID=sharInfo->rootID;
    }
    sprintf(sql,"update df_mes set tomb = 1 where filename = '%s' and parID = %d and tomb=0;",filename,parID);
    
    printf("sql = %s\n",sql);
    mysql_query(mysql,sql);
    int ret=0;
    send(netfd,&ret,sizeof(ret),MSG_NOSIGNAL);
    return 0;
}
